name: Clear cache weekly

on:
  workflow_dispatch:
    inputs:
      pattern:
        description: "pattern for cleaning cache"
        default: "pip-|conda"
        required: false
        type: string

jobs:
  cron-clear:
    if: github.event_name == 'schedule'
    uses: Lightning-AI/utilities/.github/workflows/clear-cache.yml@v0.10.1
    with:
      pattern: "latest|docs"

  direct-clear:
    if: github.event_name == 'workflow_dispatch'
    uses: Lightning-AI/utilities/.github/workflows/clear-cache.yml@v0.10.1
    with:
      pattern: ${{ inputs.pattern }}
